﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using TJDevHouse.Starcraft.Game;

namespace TJDevHouse.Starcraft.MapAnalyser.Analysers
{
	public class WalkabilityZoneAnalysisResult
	{
		/// <summary>
		/// The map used for the analysis
		/// </summary>
		public Map Map { get; private set; }

		/// <summary>
		/// A collection of tiles arranged by zone
		/// </summary>
		public Dictionary<int, List<WalkTile>> TilesByZone { get; set; }

		/// <summary>
		/// Zone numbers stored by tile coords (y,x)
		/// </summary>
		public int[,] ZonesByTiles { get; set; }

		public WalkabilityZoneAnalysisResult(Map map)
		{
			Map = map;
			TilesByZone = new Dictionary<int, List<WalkTile>>();
			ZonesByTiles = new int[map.MapWalkableHeight, map.MapWalkableWidth];
		}

		public void AddTileToZone(int zoneID, WalkTile tile)
		{
			if (!TilesByZone.ContainsKey(zoneID))
			{
				TilesByZone.Add(zoneID, new List<WalkTile>());
			}

			TilesByZone[zoneID].Add(tile);
			ZonesByTiles[tile.Y, tile.X] = zoneID;
		}
	}
}
